package shuogg.mysql.dao;

import java.sql.SQLException;

public class StudentDao {
    public int updateTuitionByName(String name, int addFee) throws SQLException {
        TxQueryRunner query = new TxQueryRunner();
        String sql = "UPDATE stu SET tuition=tuition+? WHERE sname=?";
        Object[] params = { addFee, name };
        int updatedRows = 0;
        updatedRows = query.update(sql, params);
        return updatedRows;
    }

    public int updateTuitionBySid(int sid, int addFee) throws SQLException {
        TxQueryRunner query = new TxQueryRunner();
        String sql = "UPDATE stu SET tuition=tuition+? WHERE sid=?";
        Object[] params = { addFee, sid };
        int updatedRows = 0;
        updatedRows = query.update(sql, params);
        return updatedRows;
    }
}
